package com.sgmder.demo.controller;

import com.sgmder.demo.pojo.User;
import com.sgmder.demo.remoteapi.RemoteUserService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class UserController {

    @Resource
    private RemoteUserService remoteUserService;

    @GetMapping ("/user/{id}")
    public String getUser(@PathVariable ("id") Long userId) {

        User user = remoteUserService.getUserById(userId);
        user.setMoreMsg("remote api ok");
        return user.toString();
    }
}
